﻿using NPOI.SS.UserModel;

namespace NpoiSample.Helper.CompleteCustomer.Dto
{
    /// <summary>
    /// 工作簿单元格dto
    /// </summary>
    public class SheetCellDto
    {
        public SheetCellDto(int row, int column, string value, CellType cellType = CellType.String,
            BaseCellStyle baseCellStyle = null, MergeConfigDto mergeConfig = null)
        {
            Row = row;
            Column = column;
            Value = value;
            CellType = cellType;
            MergeConfig = mergeConfig;
            BaseCellStyle = baseCellStyle;
        }

        public SheetCellDto(int row, int column, string value, int height, CellType cellType = CellType.String,
            BaseCellStyle baseCellStyle = null, MergeConfigDto mergeConfig = null)
        {
            Row = row;
            Column = column;
            Value = value;
            Height = height > 1 ? height * 20 : 0;
            CellType = cellType;
            BaseCellStyle = baseCellStyle;
            MergeConfig = mergeConfig;
        }

        /// <summary>
        /// 行
        /// </summary>
        public int Row { get; }

        /// <summary>
        /// 列
        /// </summary>
        public int Column { get; }

        /// <summary>
        /// 单元格的值
        /// </summary>
        public string Value { get; }

        /// <summary>
        /// 单元数据格式
        /// </summary>
        public CellType CellType { get; }

        /// <summary>
        /// 行高
        /// </summary>
        public int Height { get; set; }

        /// <summary>
        /// 样式
        /// </summary>
        public BaseCellStyle BaseCellStyle { get; set; }

        /// <summary>
        /// 合并配置
        /// </summary>
        public MergeConfigDto MergeConfig { get; set; }
    }
}